//
//  Kylin_TopicAudioView.m
//  03-BuDeJie
//
//  Created by Kylin on 16/3/3.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_TopicAudioView.h"
#import "Kylin_TopicItem.h"

@interface Kylin_TopicAudioView()
@property (weak, nonatomic) IBOutlet UILabel *playcountLabel;
@property (weak, nonatomic) IBOutlet UILabel *audiotimeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end

@implementation Kylin_TopicAudioView

- (void)setTopicItem:(Kylin_TopicItem *)topicItem{
    
    _topicItem = topicItem;
    
    [self.imageView Kylin_setLargeImageUrl:topicItem.image1 smallImageUrl:topicItem.image0 placeholder:[UIImage imageNamed:@"defaultUserIcon"]];
    
    if (topicItem.playcount >= 10000) {
        self.playcountLabel.text = [NSString stringWithFormat:@"%.1f万播放", topicItem.playcount / 10000.0];
    } else {
        self.playcountLabel.text = [NSString stringWithFormat:@"%zd播放", topicItem.playcount];
    }
    
    NSInteger minutes = topicItem.voicetime / 60;
    NSInteger seconds = topicItem.videotime % 60;
    
    self.audiotimeLabel.text = [NSString stringWithFormat:@"%02zd:%02zd",minutes,seconds];
}


@end
